/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gcliff.dao.glpks;

import com.gcliff.rowMapper.glpks.SsoRM;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
import oracle.jdbc.OracleTypes;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.StoredProcedure;

/**
 *
 * @author krishna
 * Code belongs to GCliff.
 */
public class ProcessUserLoginDAO extends StoredProcedure {

    protected static final Log log = LogFactory.getLog(ProcessUserLoginDAO.class);

    public ProcessUserLoginDAO() {
    }

    public ProcessUserLoginDAO(DataSource dataSource) {
        super();
        this.setDataSource(dataSource);
        this.setFunction(false);
        this.setSql("GLPKS.PR_PROCESS_USER_LOGIN");
        this.declareParameter(new SqlParameter("PI_USER_NAME", OracleTypes.VARCHAR));
        this.declareParameter(new SqlParameter("PI_USER_PASSWORD", OracleTypes.VARCHAR));
        this.declareParameter(new SqlOutParameter("PO_RESULT_SET", OracleTypes.CURSOR, new SsoRM()));        
        this.compile();
    }

    public Map<String, Object> processUserLogin(String userName, String password) {
         Map inParams = new HashMap();
        inParams.put("PI_USER_NAME", userName);
        inParams.put("PI_USER_PASSWORD", password);
        return super.execute(inParams);
    }
    
}
